package io.gitee.xyuesheng.day04;

import java.sql.Time;
import java.util.Timer;
import java.util.TimerTask;

public class DemoTimer2 {
    static int i = 0;
    int j = 1;

    public static void main(String[] args) {
        Timer timer = new Timer();

        DemoTimer2 out = new DemoTimer2();
        timer.schedule(new DemoTimer2().new CountTask(), 1000, 2000);

//        timer.schedule(new CountTask(),0,2000);

    }

    public void count() {
        this.j++;
    }

    class CountTask extends TimerTask {
        int j = 10;

        @Override
        public void run() {
            //System.out.println("count:"+j++);
            //count();
            System.out.println("count:" + DemoTimer2.this.j++);
            System.out.println("count:" + this.j++);
        }
    }

}

